package com.hbnu.mapper;

import com.hbnu.pojo.Good;
import com.hbnu.pojo.Collection;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CartMapper {
    @Insert("insert into cart (uid,gid,count) value (#{uid},#{gid},#{count})")
    void insertCart(String uid,String gid,Integer count);

    @Delete("delete from cart where uid=#{uid} and gid=#{gid}")
    void deleteCart(String uid,String gid);

    @Select("select * from cart where uid=#{uid}")
    List<Collection> getCartListByUid(String uid);

    @Select("select * from good where gid=#{gid}")
    Good getGoodByGid(String gid);

    @Update("update cart set count=#{count} where gid=#{gid} and uid=#{uid}")
    void updateCart(Integer count,String gid,String uid);
}
